package view.mainscreen;

import java.awt.Color;
import java.awt.Dimension;
import java.io.IOException;
import javax.swing.ActionMap;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class StatusBar extends JScrollPane 
{ final static Dimension size = new Dimension(825,80);//842,75
  private static JTextArea console = new JTextArea();
  public StatusBar() throws IOException
  { this.setPreferredSize(size);
    this.setSize(size);
    this.setMinimumSize(size);
    this.setMaximumSize(size);
    this.add(console);
    this.horizontalScrollBarPolicy = JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS;
    this.verticalScrollBarPolicy = JScrollPane.VERTICAL_SCROLLBAR_ALWAYS;
    this.setFocusable(false);
    console.setSize(size);
    console.setPreferredSize(size);
    console.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
    console.setMinimumSize(size);
    console.setBackground(Color.BLACK);
    console.setForeground(Color.WHITE);
    console.setActionMap(new ActionMap());
    this.setViewportView(console);
    console.setFocusable(false);
    this.setFocusable(false);
  }
  public static void println(String _consoleText){
	  console.setFocusable(true);
	  console.append(_consoleText+"\n");
	  Dimension newSize = new Dimension(825,console.getLineCount()*20);
	  console.setSize(newSize);
	  console.setPreferredSize(newSize);
	  console.setMinimumSize(newSize);
	  console.setFocusable(false);
  }
}
